/**
 * PropertyReader.java
 * Created 28 Sep 2011
 */
package com.fastwire.alarm.common.view.util;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


/**
 * @author sigit <br>
 * @version 1.0 <br>
 * Application : alarmmanagement <br>
 * Copyright (c) fastwire-group 2011 <br>
 * <br>
 */
public class PropertyReader {
	
	private static final String ALARM_PROPERTIES_FILE = "alarm.properties";

	private static PropertyReader readingProperty = new PropertyReader();

	private static Properties properties;

	private PropertyReader() {
		properties = new Properties();
		try {
			ClassLoader cl = this.getClass().getClassLoader();
			InputStream stream = cl.getResourceAsStream(ALARM_PROPERTIES_FILE);
			properties.load(stream);
		} catch (FileNotFoundException err) {
			err.printStackTrace();
		} catch (IOException err) {
			err.printStackTrace();
		}

	}

	public static String getProperty(String sNameProperty) {
		if (readingProperty == null)
			readingProperty = new PropertyReader();
		return (properties.getProperty(sNameProperty).trim());
	}
}
